import Home from '../views/Home.vue'
import Map from '../components/CesiumMap.vue'
import ArcgisMap from '../components/ArcgisMap.vue'
import RENFANG from '../components/refang.vue'
import NJScenic from '../components/arcgisScenicNj.vue'
import QHHHEATMAP from '../components/qhh-heatmap.vue'
import mapInfo from '../components/mapsInfo.vue'
import water from '../components/xdm.vue'
import ggg from '../views/home-code.vue'
// import ggg from '../components/mapTwo/qhh-heatmap-KG.vue'

// 路由越前，其优先级越大【* /放最后】
const routes: any = [
  {
    path: '/heatmap',
    name: 'heatmap',
    component: ggg,
  },
  {
    path: '/njScenic',
    name: 'NJScenic',
    component: NJScenic,
  },
  {
    path: '/renfang',
    name: 'RENFANG',
    component: RENFANG,
  },
  {
    path: '/arcgismap',
    // 设置别名
    name: 'arcgismap',
    component: ArcgisMap,
  },
  {
    path: '/map',
    // 设置别名
    name: 'Map',
    component: Map,
  },
  {
    path: '/',
    // 设置别名
    alias: '/hometwo',
    name: 'Home',
    props: (route: any) => ({
      food: route.query.food,
    }),
    component: Home,
  },
  {
    path: '/about/:id',
    name: 'About',
    props: true, // props里面的属性加载到路由路径的name里面
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ '../views/About.vue'),
  },
  {
    path: '/panter/:id',
    name: 'Panter',
    component: () => import('../views/Panter.vue'),
    children: [
      {
        path: 'child',
        // alias: 'hometwo',
        name: 'Child',
        props: {
          // food: '牛肉'
        },
        component: () => import('../views/Child.vue'),
      },
    ],
  },
  {
    path: '/store',
    name: 'Store',
    component: () => import('../views/Store.vue'),
  },
  {
    path: '/name_views',
    components: {
      default: () => import('../views/Panter.vue'),
      email: () => import('../views/Child.vue'),
      tel: () => import('../views/Child.vue'),
    },
  },
  // 重定向
  {
    path: '/main',
    redirect: (to: any) => {
      // console.log(to)
      return { name: 'Panter' }
    },
  },
  // history模式下未找到页面，默认跳转
  {
    path: '*',
    name: 'Error_404',
    component: () => import('../views/Error_404.vue'),
  },
]

export default routes
